<?php
class MentionsController extends AppController{


	public  function index(){
        $this->autoRender=true;
		echo "mentions";
	}
	public function list_mention(){
		$this->autoRender = false;
		$err = null;
		$response;
		if($this->request->is('post')){
			if(empty($this->request->data['tweet_id'])){
				$err .= "not found tweet_id param";

			}


			//debug($this->request->data);
			//debug(empty($err));
			if(empty($err)){
				//check da retweet chua


				$tweetId = $this->request->data['tweet_id'];

				//$this->Tweet->unbindModel(array('hasMany'=>array('Timeline','Mention','Favorite'),'hasOne'=>array('Place')));
				$mentionsUser = $this->Mention->findAllByTweetId($tweetId,array('User.id','User.username','User.screen_name','User.email','User.avatar','User.created'));
				//debug($mentionsUser);



				//debug($listuser);
				$response = array("status_code" => 0,"message" => 'ok',"entity" =>$mentionsUser);
			}
			else {
				$response = array("status_code" => -1,"message" => $err,"entity" =>'');
			}
			echo json_encode($response);

		}
	}
}